package answer;

/**
 * 定义 Point、Circle、Cylinder 三个类， 三个类都拥有 x,y 属性， 而 Circle 又增加了属性radius， Cylinder
 * 类又增加了属性 height。 都有获得 x,y 坐标，设置 x,y 坐标，求面积、体积的方法。
 *
 */

public class Answer19 {
	public static void main(String[] args) {
		Circle circle = new Circle(2, 6, 10);
		System.out.println("面积：" + circle.veat());
		Cylinder cylinder = new Cylinder(2, 6, 10, 5);
		System.out.println("体积：" + cylinder.volum());
	}
}

class Point {

	int x, y;

	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
}

class Circle extends Point {
	public Circle(int x, int y, int radius) {
		super(x, y);
		this.radius = radius;
	}

	int radius;

	public float veat() {
		return (float) (radius * radius * 3.14);
	}
}

class Cylinder extends Circle {
	int height;

	public Cylinder(int x, int y, int radius, int height) {
		super(x, y, radius);
		this.height = height;
	}

	public float volum() {
		return super.veat() * height;
	}
}
